package B.w.OOday02;

public class Student extends Person{
    String className;
    String stuID;//this指({派生类}子类）学生对象 super指（超类）Person对象 父不能访问子
    // 虽然都能用this但同名时super指的是超类的name，this指的是（就近原则）当前类的name
    Student(String name,int age,String address,String className,String stuID){
        super(name,age,address);

        /*super.name = name;
        super.age = age;
        super.address = address;*/
        this.className = className;
        this.stuID = stuID;
    }
 /*上箭头表示重写*/   /*void sayHi() {
        System.out.println(name+"敢问路在何方");
        }*/
 void sayHi(){
     System.out.println("大家好，我叫"+name+"今年"+age+"岁了,家住"+address+",所在班级为"+className+"学号为："+stuID); }

    void study(){
        System.out.println(name+"正在学习");
    }
}
